home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / muds / pennmush.000 / pennmush-1.50-p8-linux.tar / pennmush / RWHO / HOW_TO < prev    next >
Text File  |  1991-07-11  |  4KB  |  99 lines

  1.  
  2. How to link the client code into your MUD, whatever it may be:
  3. --------------------------------------------------------------
  4.  
  5.     First off, compile clilib.c and make sure it's more or less
  6. correct. It should compile without errors/warnings. If it does, let
  7. someone know!
  8.  
  9.     Then, insert the appropriate calls into your MUD to handle
  10. initializing and submitting rwho information. The things you need to
  11. do are as follows:
  12.  
  13.     1) When the MUD first becomes active for play, send the rwho
  14.        server a "this mud is up" packet. That is done with a call
  15.  
  16.     rwhocli_setup(server,serverpw,myname,comment);
  17.     char    *server;
  18.     char    *serverpw;
  19.     char    *myname;
  20.     char    *comment;
  21.  
  22.        in which "server" is the internet address, in text form
  23.        or "dot" notation of your rwho server. "serverpw" is the
  24.        password you have agreed upon with the server's keeper.
  25.        "myname" is the name of your MUD, and should be UNIQUE
  26.        and reasonably short. "comment" is typically a short (20 char)
  27.        description of the MUD and version. (EG: "UnterMUD V1.0a")
  28.  
  29.        Typically, the above call should go someplace in the main()
  30.        function of the MUD, someplace before the main loop is started,
  31.        and after everything else is set up.
  32.  
  33.     NONE OF THESE VALUES CAN CONTAIN TABS OR BE NULL. TABS ARE A
  34.     SPECIAL DELIMITER USED BY THE RWHO SERVER.
  35.  
  36.  
  37.     2) At the point in which a player's login is validated, insert
  38.        a call to send the "player has logged in" message to the rwho
  39.        server. The format is:
  40.  
  41.     rwhocli_userlogin(uid,name);
  42.     char    *uid;
  43.     char    *name;
  44.  
  45.        in which "uid" is a UNIQUE (within your MUD) specifier of th
  46.        user's identity, and the "name" is a longer-form of ID. This
  47.        is designed primarily with UnterMUD in mind, since it is quite
  48.        possible to have 2 player objects from different MUDs logged
  49.        into the same server, with the same name. The "uid" is unique.
  50.        If your MUD has no similar concept, send the "uid" and an empty
  51.        string for "name".
  52.  
  53.  
  54.     3) At the point in which a player is logged out, insert a call to
  55.        send the "player has logged out" message to the rwho server:
  56.  
  57.     rwhocli_userlogout(uid);
  58.     char    *uid;
  59.  
  60.        in which "uid" is the unique identifier of your local player who
  61.        has logged out.
  62.  
  63.  
  64.     4) At some interval, your MUD should do an update to the server of
  65.        everyone that is on. This consists of the MUD server doing a
  66.        "ping!" option, which informs the rwho server that th MUD is
  67.        still running, followed with a list of all the logged in users.
  68.  
  69.     rwhocli_pingalive();     /* first send the ping. */
  70.  
  71.        In UnterMUD, this looks like the following:
  72.     
  73.     io_rstnxtwho();
  74.     rwhocli_pingalive();
  75.     while((xx = io_nxtwho()) != (char *)0)
  76.         rwhocli_userlogin(xx,ut_name(xx));
  77.  
  78.        where "io_nxtwho()" gives the unique object ID of each logged
  79.        in player, and we pass the "uid" and player "name" to the rwho
  80.        server. This operation should be performed as often as the
  81.        rwho server "expires" its tables, (default is 5 minutes, so
  82.        you should do this every 4 minutes or so). Doing this loop is
  83.        very computationally inexpensive, since the data is all just
  84.        flung out in UDP packets.
  85.  
  86.  
  87.     5) Last but not least, at the point in your code where the MUD
  88.        shuts down, send a "this mud is down" message to the rwho
  89.        server:
  90.  
  91.     rwhocli_shutdown();
  92.  
  93.        which says "goodbye", closes sockets, and frees memory. If
  94.        for some reason your MUD crashes and CANNOT send this information,
  95.        the rwho server will eventually time your MUD out of its tables,
  96.        which effectively marks it as down.
  97.  
  98. mjr.
  99.